package com.suoluo.zenadmin.common;

import net.paoding.rose.scanning.context.RoseWebAppContext;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

public class Application implements ApplicationContextAware{

	
	private static Application instance = new Application();
	
	public static Application getInstance(){
		return instance;
	}
	private ApplicationContext context;
	
	@Override
	public void setApplicationContext(ApplicationContext context)
			throws BeansException {
		this.context = context;
	}
	
	public String getPath(String path){
			return ((RoseWebAppContext)context).getServletContext().getRealPath(path);
	
	}
	
	public <T> T getBean(String name,Class<T> clazz){
		return this.context.getBean(name, clazz);
	}

}
